home *** CD-ROM | disk | FTP | other *** search
- #include "texture.h"
-
-
- /* */
- void GLAPIENTRY glGenTextures(GLsizei n, GLuint *textures) {
- GLContext *c = gl_get_context();
- int max, i;
- GLTexture *t;
-
- max = 0;
- for(i = 0; i < TEXTURE_HASH_TABLE_SIZE; i++) {
- t = c->shared_state.texture_hash_table[i];
- while(t != NULL) {
- if(t->handle > max) {
- max = t->handle;
- }
-
- t = t->next;
- }
- }
-
- for(i = 0; i < n; i++) {
- textures[i] = max + i + 1;
- }
- }
-
- /* */
- void GLAPIENTRY glDeleteTextures(GLsizei n, const GLuint *textures) {
- GLContext *c = gl_get_context();
- int i;
- GLTexture *t;
-
- for(i = 0; i < n; i++) {
- t = find_texture(c, textures[i]);
- if(t != NULL && t != 0) {
- if(t == c->current_texture) {
- glBindTexture(GL_TEXTURE_2D, 0);
- }
-
- free_texture(c, textures[i]);
- }
- }
- }
-